package com.lemei.cn.adpter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.List;

/**
 * Created by 赵航 on 2017/6/4.
 */

public class MyFragmentAdpter extends FragmentStatePagerAdapter {

    private List<Fragment> mList;
    private String[] brr;

    public MyFragmentAdpter(FragmentManager fm, List<Fragment> fragmentList,String[] arr) {
        super(fm);
        mList = fragmentList;
        brr = arr;
    }
    //返回的fragment
    @Override
    public Fragment getItem(int position) {
        return mList.get(position);
    }

    //显示多少页
    @Override
    public int getCount() {

        return mList==null?0: mList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return brr[position];
    }
}
